.class public Lcom/xingbook/service/download/b;
.super Ljava/lang/Object;


# static fields
.field private static i:Lcom/xingbook/service/download/b;


# instance fields
.field a:Landroid/content/Context;

.field b:Landroid/os/Messenger;

.field c:Z

.field d:Ljava/util/ArrayList;

.field e:Lcom/xingbook/service/download/e;

.field f:Lcom/xingbook/service/download/a;

.field g:Ljava/util/ArrayList;

.field final h:Landroid/os/Messenger;

.field private j:Landroid/os/Handler;

.field private k:Landroid/content/ServiceConnection;


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .locals 3

    const/4 v2, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object v2, p0, Lcom/xingbook/service/download/b;->b:Landroid/os/Messenger;

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/xingbook/service/download/b;->c:Z

    new-instance v0, Ljava/util/ArrayList;

    const/4 v1, 0x4

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    iput-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;

    iput-object v2, p0, Lcom/xingbook/service/download/b;->e:Lcom/xingbook/service/download/e;

    iput-object v2, p0, Lcom/xingbook/service/download/b;->f:Lcom/xingbook/service/download/a;

    new-instance v0, Lcom/xingbook/service/download/d;

    invoke-direct {v0, p0}, Lcom/xingbook/service/download/d;-><init>(Lcom/xingbook/service/download/b;)V

    iput-object v0, p0, Lcom/xingbook/service/download/b;->j:Landroid/os/Handler;

    new-instance v0, Landroid/os/Messenger;

    iget-object v1, p0, Lcom/xingbook/service/download/b;->j:Landroid/os/Handler;

    invoke-direct {v0, v1}, Landroid/os/Messenger;-><init>(Landroid/os/Handler;)V

    iput-object v0, p0, Lcom/xingbook/service/download/b;->h:Landroid/os/Messenger;

    new-instance v0, Lcom/xingbook/service/download/c;

    invoke-direct {v0, p0}, Lcom/xingbook/service/download/c;-><init>(Lcom/xingbook/service/download/b;)V

    iput-object v0, p0, Lcom/xingbook/service/download/b;->k:Landroid/content/ServiceConnection;

    iput-object p1, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    new-instance v0, Ljava/util/ArrayList;

    const/16 v1, 0x8

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    iput-object v0, p0, Lcom/xingbook/service/download/b;->g:Ljava/util/ArrayList;

    return-void
.end method

.method public static a(Landroid/content/Context;)Lcom/xingbook/service/download/b;
    .locals 1

    sget-object v0, Lcom/xingbook/service/download/b;->i:Lcom/xingbook/service/download/b;

    if-nez v0, :cond_0

    new-instance v0, Lcom/xingbook/service/download/b;

    invoke-direct {v0, p0}, Lcom/xingbook/service/download/b;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/xingbook/service/download/b;->i:Lcom/xingbook/service/download/b;

    :cond_0
    sget-object v0, Lcom/xingbook/service/download/b;->i:Lcom/xingbook/service/download/b;

    invoke-virtual {v0}, Lcom/xingbook/service/download/b;->d()V

    sget-object v0, Lcom/xingbook/service/download/b;->i:Lcom/xingbook/service/download/b;

    return-object v0
.end method


# virtual methods
.method public a()Lcom/xingbook/service/download/e;
    .locals 1

    iget-object v0, p0, Lcom/xingbook/service/download/b;->e:Lcom/xingbook/service/download/e;

    return-object v0
.end method

.method public a(Lcom/xingbook/service/download/a;)V
    .locals 0

    iput-object p1, p0, Lcom/xingbook/service/download/b;->f:Lcom/xingbook/service/download/a;

    return-void
.end method

.method public a(Lcom/xingbook/service/download/k;)V
    .locals 5

    iget-object v0, p0, Lcom/xingbook/service/download/b;->g:Ljava/util/ArrayList;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/xingbook/service/download/b;->g:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    iget-object v0, p0, Lcom/xingbook/service/download/b;->e:Lcom/xingbook/service/download/e;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/service/download/b;->e:Lcom/xingbook/service/download/e;

    iget-object v1, p0, Lcom/xingbook/service/download/b;->g:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    invoke-interface {v0, v1}, Lcom/xingbook/service/download/e;->a(I)V

    :cond_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-lez v0, :cond_1

    iget-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_2

    :cond_1
    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->b:Landroid/os/Messenger;

    const/4 v1, 0x0

    const/4 v2, 0x1

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-static {v1, v2, v3, v4, p1}, Landroid/os/Message;->obtain(Landroid/os/Handler;IIILjava/lang/Object;)Landroid/os/Message;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/os/Messenger;->send(Landroid/os/Message;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_1
    return-void

    :cond_2
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/xingbook/service/download/m;

    invoke-interface {v0}, Lcom/xingbook/service/download/m;->a_()V

    goto :goto_0

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V

    goto :goto_1
.end method

.method public declared-synchronized a(Lcom/xingbook/service/download/m;)V
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z

    iget-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-void

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public a(Ljava/lang/String;)V
    .locals 3

    const/4 v2, 0x0

    const/4 v0, 0x0

    const/4 v1, 0x2

    invoke-static {v0, v1, v2, v2}, Landroid/os/Message;->obtain(Landroid/os/Handler;III)Landroid/os/Message;

    move-result-object v0

    iput-object p1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    :try_start_0
    iget-object v1, p0, Lcom/xingbook/service/download/b;->b:Landroid/os/Messenger;

    invoke-virtual {v1, v0}, Landroid/os/Messenger;->send(Landroid/os/Message;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V

    goto :goto_0
.end method

.method public a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
    .locals 8

    const/4 v7, 0x0

    const/4 v0, 0x0

    const/4 v6, 0x3

    const/4 v5, 0x2

    const/4 v4, 0x1

    if-eqz p1, :cond_0

    const-string v1, ""

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    if-eqz p3, :cond_0

    const-string v1, ""

    invoke-virtual {v1, p3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    invoke-virtual {p0, p1}, Lcom/xingbook/service/download/b;->d(Ljava/lang/String;)Lcom/xingbook/service/download/k;

    move-result-object v1

    if-eqz v1, :cond_8

    invoke-virtual {v1}, Lcom/xingbook/service/download/k;->b()I

    move-result v2

    if-eqz v2, :cond_2

    if-eq v2, v4, :cond_2

    if-eq v2, v5, :cond_2

    if-ne v2, v6, :cond_5

    :cond_2
    if-ne p4, v4, :cond_4

    const-string v1, "\u8be5\u300e\u661f\u5b9d\u4e66\u300f\u5185\u5bb9\u6b63\u5728\u4e0b\u8f7d"

    :goto_1
    if-eqz v1, :cond_3

    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    invoke-static {v0, v1, v7}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v0

    :cond_3
    :goto_2
    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/widget/Toast;->show()V

    goto :goto_0

    :cond_4
    const/4 v1, 0x4

    if-eq p4, v1, :cond_d

    if-eq p4, v6, :cond_d

    if-ne p4, v5, :cond_d

    const-string v1, "\u8be5\u8bfe\u7a0b\u5185\u5bb9\u6b63\u5728\u4e0b\u8f7d"

    goto :goto_1

    :cond_5
    const/4 v3, 0x5

    if-ne v2, v3, :cond_7

    if-ne p4, v4, :cond_6

    const-string v1, "\u8be5\u300e\u661f\u5b9d\u4e66\u300f\u5185\u5bb9\u5df2\u4e0b\u8f7d\u5b8c\u6210"

    :goto_3
    if-eqz v1, :cond_3

    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    invoke-static {v0, v1, v7}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v0

    goto :goto_2

    :cond_6
    const/4 v1, 0x4

    if-eq p4, v1, :cond_c

    if-eq p4, v6, :cond_c

    if-ne p4, v5, :cond_c

    const-string v1, "\u8be5\u8bfe\u7a0b\u5185\u5bb9\u5df2\u4e0b\u8f7d\u5b8c\u6210"

    goto :goto_3

    :cond_7
    invoke-virtual {v1}, Lcom/xingbook/service/download/k;->a()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/xingbook/service/download/b;->b(Ljava/lang/String;)V

    goto :goto_2

    :cond_8
    new-instance v1, Lcom/xingbook/service/download/k;

    invoke-direct {v1, p1, p2, p3, p4}, Lcom/xingbook/service/download/k;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V

    invoke-virtual {p0, v1}, Lcom/xingbook/service/download/b;->a(Lcom/xingbook/service/download/k;)V

    if-ne p4, v4, :cond_9

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "\u5f00\u59cb\u4e0b\u8f7d\u300a"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "\u300b"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    :goto_4
    if-eqz v1, :cond_3

    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    invoke-static {v0, v1, v7}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v0

    goto :goto_2

    :cond_9
    if-ne p4, v5, :cond_a

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "\u5f00\u59cb\u4e0b\u8f7d\u300a"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const/16 v2, 0x300b

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    goto :goto_4

    :cond_a
    if-eq p4, v6, :cond_b

    :cond_b
    move-object v1, v0

    goto :goto_4

    :cond_c
    move-object v1, v0

    goto :goto_3

    :cond_d
    move-object v1, v0

    goto/16 :goto_1
.end method

.method public b()Landroid/content/Context;
    .locals 1

    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    return-object v0
.end method

.method public declared-synchronized b(Lcom/xingbook/service/download/m;)V
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-void

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public b(Ljava/lang/String;)V
    .locals 5

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->b:Landroid/os/Messenger;

    const/4 v1, 0x0

    const/4 v2, 0x3

    const/4 v3, 0x3

    const/4 v4, 0x0

    invoke-static {v1, v2, v3, v4, p1}, Landroid/os/Message;->obtain(Landroid/os/Handler;IIILjava/lang/Object;)Landroid/os/Message;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/os/Messenger;->send(Landroid/os/Message;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V

    goto :goto_0
.end method

.method public c()Lcom/xingbook/service/download/a;
    .locals 1

    iget-object v0, p0, Lcom/xingbook/service/download/b;->f:Lcom/xingbook/service/download/a;

    return-object v0
.end method

.method public c(Ljava/lang/String;)V
    .locals 5

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->b:Landroid/os/Messenger;

    const/4 v1, 0x0

    const/4 v2, 0x3

    const/4 v3, 0x4

    const/4 v4, 0x0

    invoke-static {v1, v2, v3, v4, p1}, Landroid/os/Message;->obtain(Landroid/os/Handler;IIILjava/lang/Object;)Landroid/os/Message;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/os/Messenger;->send(Landroid/os/Message;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V

    goto :goto_0
.end method

.method public d(Ljava/lang/String;)Lcom/xingbook/service/download/k;
    .locals 3

    iget-object v0, p0, Lcom/xingbook/service/download/b;->g:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :cond_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_1

    const/4 v0, 0x0

    :goto_0
    return-object v0

    :cond_1
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/xingbook/service/download/k;

    invoke-virtual {v0}, Lcom/xingbook/service/download/k;->a()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_0

    goto :goto_0
.end method

.method public declared-synchronized d()V
    .locals 4

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    new-instance v1, Landroid/content/Intent;

    iget-object v2, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    const-class v3, Lcom/xingbook/service/download/DownloadService;

    invoke-direct {v1, v2, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    iget-object v2, p0, Lcom/xingbook/service/download/b;->k:Landroid/content/ServiceConnection;

    const/4 v3, 0x1

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-void

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized e()V
    .locals 4

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/xingbook/service/download/b;->c:Z

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/xingbook/service/download/b;->c:Z

    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    iget-object v1, p0, Lcom/xingbook/service/download/b;->k:Landroid/content/ServiceConnection;

    invoke-virtual {v0, v1}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V

    iget-object v0, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    new-instance v1, Landroid/content/Intent;

    iget-object v2, p0, Lcom/xingbook/service/download/b;->a:Landroid/content/Context;

    const-class v3, Lcom/xingbook/service/download/DownloadService;

    invoke-direct {v1, v2, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    invoke-virtual {v0, v1}, Landroid/content/Context;->stopService(Landroid/content/Intent;)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    monitor-exit p0

    return-void

    :catch_0
    move-exception v0

    :try_start_1
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized f()Ljava/util/ArrayList;
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/service/download/b;->d:Ljava/util/ArrayList;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public g()Ljava/util/ArrayList;
    .locals 1

    iget-object v0, p0, Lcom/xingbook/service/download/b;->g:Ljava/util/ArrayList;

    return-object v0
.end method
